/**
 * 
 */
package org.rescue.web;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.ArrayList;

import org.rescue.search.*;


/**
 * @author jlickfet
 *
 */
public class DeleteDataset extends HttpServlet {

	public void doPost(HttpServletRequest request, HttpServletResponse response)
		throws IOException, ServletException {
	
		// delete the indicated dataset from the database
		int datasetId = Integer.valueOf(request.getParameter("dataset")).intValue();
		DatasetDB datasetDB = new DatasetDB();
		datasetDB.deleteDataset(datasetId);

		// get updated listing of datasets to display in select box
		ArrayList<DatasetListing> listing = datasetDB.getDatasetListing(); 			
		request.setAttribute("listing", listing);		
		
		// display the view
		//request.setAttribute("message","deleted a dataset");
		RequestDispatcher view = request.getRequestDispatcher("manage_configuration.jsp");
		view.forward(request,response);
		
	}
		
}
